package com.cskaoyan.bean.order.wxGetOrder;

import com.cskaoyan.bean.domain.Order;
import lombok.Data;

/**
 * @author looper
 * @ 全部默认flase根据订单状态赋值
 **/
@Data
public class HandleOption {
    //订单状态来判断 是否取消
    private Short orderStatus;
    Boolean cancel = true;
    //订单状态来判断 是否售后,
    private Short aftersaleStatus;
    Boolean aftersale = false;
    //是否评论
    private Short comments;

    Boolean comment = false;
    //订单状态来判断 是否确认收获
    Boolean confirm = false;

    //似乎都是true
    Boolean delete = true;

    //订单状态来判断 是否确认收获
    Boolean pay = false;
    //订单状态来判断 是否确认退款
    Boolean refund = false;
    //是否回购,先等于false吧
    Boolean rebuy = false;

    public void setOrderStatus(Short orderStatus) {
        this.orderStatus = orderStatus;
        Integer status = Integer.parseInt(orderStatus.toString());
        if (102 == status || 103 == status) {
            this.setCancel(false);
            this.setAftersale(false);
        }
        if (401 == status || 402 == status) {
            this.setRebuy(true);
            this.setCancel(false);
            this.setComment(true);
        }
        if (301 == status) {
            this.setConfirm(true);
            this.setCancel(false);
            this.setDelete(false);
        }
        if (status == 101) {
            this.setAftersale(false);
            this.setPay(true);
        }
        // TODO: 2021/12/2

    }

    public void setCancel(Boolean cancel) {
        this.cancel = cancel;
    }

    public void setAftersaleStatus(Short aftersaleStatus) {
        this.aftersaleStatus = aftersaleStatus;
        Integer afterStatus = Integer.parseInt(aftersaleStatus.toString());
        //0表示可以申请售后5是取消售后 ,其他时候都表示在售后
        if (0 != afterStatus || 5 != aftersaleStatus) {
            this.setAftersale(true);
        }
    }

    public void setAftersale(Boolean aftersale) {
        this.aftersale = aftersale;
    }

    public void setComments(Short comments) {
        this.comments = comments;
//        if (comments>0) {
//            this.setComment(true);
//        }
    }

    public void setComment(Boolean comment) {
        this.comment = comment;
    }

    public void setConfirm(Boolean confirm) {
        this.confirm = confirm;
    }

    public void setPay(Boolean pay) {
        this.pay = pay;
    }

    public void setRefund(Boolean refund) {
        this.refund = refund;
    }


}
